#pragma once

#ifdef VOSMFACADEDLL_EXPORTS
#define VOSMFACADEDLL_API __declspec(dllexport)
#else
#define VOSMFACADEDLL_API __declspec(dllimport)
#endif

#include <string>
#include <vector>
#include "opencv2/myopencv.hpp"

using namespace std;

class VO_Fitting2DSM;
class CFaceDetectionAlgs;

typedef struct VOSMFaceComp {
	cv::Rect face;
	cv::Point2f leftEye, rightEye, mouth;
} TVOSMFaceComp;

class VOSMFACADEDLL_API VOSM {
private:
	VO_Fitting2DSM* fitting2dsm;
	CFaceDetectionAlgs* fd;
	bool isLoadASM;
	bool isLoadFD;
public:
	VOSM(void){
		fitting2dsm = NULL;
		fd = NULL;
		isLoadFD = isLoadASM = false;
	}

	bool smbuidlingSimple(string db);

	bool smbuilding(string imgDir, string annoDir, 
		string shapePath, string annoFormat,
		//optional
		string outDir = "./", int nChannel = 3,
		string statMod = "SMNDPROFILE", int pyrLev = 4,
		double PCAthresh = 0.95);

	bool smfitting(string modelDir, string testDir,
		//optional
		string statMod = "ASM_PROFILEND", bool isStatic = true,
		bool verbose = false);

	bool loadASMModel(string modelDir, 
		//optional
		string statMod = "ASM_PROFILEND");

	bool loadFDModel(string opencvDir="D:/program files/opencv231/");

	bool faceDectection(cv::Mat img, VOSMFaceComp& face,
		//optional
		cv::Rect* ROI = NULL);

	bool fitASM(cv::Mat img, TVOSMFaceComp face, vector<cv::Point2f>& pointList,
		//optional
		string statMod = "ASM_PROFILEND");

	bool drawASM(cv::Mat img, const vector<cv::Point2f>& plist);
};
